<!-- 待约面-约面 -->
<template>
  <RTHeader label="面试环节" :statusInfo="statusInfo"></RTHeader>
  <div class="btns">
    <Button color="success" v-auth="'appointmentInterview'" @click="interviewSession">预约面试</Button>
    <Button color="primary" v-auth="'noContact'"  @click="noContact">未联系上</Button>
    <Button color="warning" v-auth="'InterviewWaive'" @click="surrender">放弃</Button>
    <Button color="#6C7DA8"  v-auth="'offlineInterviewDetail'" @click="offline">线下到面</Button>
  </div>
  <BookInterviewModal ref="modal" @closeModal="closeModal"></BookInterviewModal>
</template>

<script setup lang='ts'>
import { ref } from "vue";
import { Button } from "@/components/Button";
import RTHeader from '../../RTHeader.vue';
import BookInterviewModal from "../../../Modals/BookInterviewModal.vue";
import { comStores } from '@/store/common/comStore';
import { interviewSchedule ,offlineInterviewType} from "@/api/application-details/index.ts";
import { message } from "ant-design-vue";
const store = comStores()


const statusInfo = ref({
  status: "待约面",
  hr: "王xx",
  count: 1
})


const emits = defineEmits(['surrender', 'disConnect'])
const surrender = () => {
  console.log('surrender')
  emits('surrender', '待约面-约面')
}
const offline = async () => {
  const { resumeId, processId } = store.currentResume;
  const { userName } = store.userInFor
  console.log('offline');
  let param = {
    "resumeId": resumeId,
    "operator": userName,
  }
  const data = await offlineInterviewType(param)
  if (data && data.code == '10000') {
    message.success('操作成功');
    await store.getResumeInfo(resumeId)
  } else {
    message.error(data.msg)
  }
}
const modal = ref<any>(BookInterviewModal)
const interviewSession = () => {
  modal.value.show = true
}
const noContact = () => {
  console.log('noContact')
  emits('disConnect', '待约面-约面')
}

const closeModal = () => {
  modal.value.show = false
}
</script>
<style lang="less" scoped>
.btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
</style>